package com.googlecode.mgwt.examples.uibinder.client.places;

import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.googlecode.mgwt.examples.uibinder.client.places.ExamplePlace.ID;

public class ExampleSourcePlace extends Place {
	private final ID id;

	public ExampleSourcePlace(ID id) {
		this.id = id;

	}

	public ID getId() {
		return id;
	}

	public static class Tokenizer implements PlaceTokenizer<ExampleSourcePlace> {

		@Override
		public ExampleSourcePlace getPlace(String token) {

			return new ExampleSourcePlace(ID.from(token));
		}

		@Override
		public String getToken(ExampleSourcePlace place) {
			return place.getId().name();
		}

	}
}
